**************************************************************************************************
****** Torn Between International Cooperation and National Sovereignty: Voter Attitudes in *******
************************* Trade-Off Situations in Switzerland ************************************
*************** RESEARCH NOTE FOR SPSR SPECIAL ISSUE ON THE SWISS ELECTIONS 2019 *****************
************ Lukas Lauener, Patrick Emmenegger, Silja Häusermann, and Stefanie Walter ************
******************************* Last modified: 22/09/2021 ****************************************
**************************************************************************************************

*****************************************************************************************
**** PART 1: RECODINGS ******************************************************************
*****************************************************************************************

*********************************************************
*** Dataset: "1184_Selects2019_Panel_Data_v1.0.0.dta" ***
*********************************************************

clear
set more off
use "...\1184_Selects2019_Panel_Data_v1.0.0.dta"

********************************************************
** 1. TRADE-OFF: IDENTIFYING CROSS-PRESSURED CITIZENS **
** IMMIGRATION CONTROL VS. INTERNATIONAL COOPERATION ***
********************************************************

*** IMMIGRATION CONTROL
* =====================
label def opinion 1 "very pos." 2 "rather pos." 3 "neither" 4 "rather neg." 5 "very neg."

* Own opinion on limiting immigration 
* ===================================
/* Welche Meinung haben Sie zu den folgenden
politischen Forderungen?
Begrenzung der Zuwanderung
1 Sehr dafür
2 Eher dafür
3 Weder noch
4 Eher dagegen
5 Sehr dagegen
*/
gen immi=W1_f15340b
tab immi
label var immi "Opinion on limiting immigration"
label val immi opinion

* Own opinion on limiting immigration (recoded in 3 categories)
gen immi3=immi
tab immi3
recode immi3 (1 2=3) (3=2) (4 5=1)
label def op3 1 "negative" 2 "neutral" 3 "positive" 
label val immi3 op3
label var immi3 "Opinion on limiting immigration"
tab immi3

* ROBUSTNESS 1. A): "Strong views"
gen immi3_strong=immi
tab immi3_strong
recode immi3_strong (1=3) (2 3 4=2) (5=1)
label def immi3_strong 1 "negative" 2 "neutral" 3 "positive" 
label val immi3_strong immi3_strong
label var immi3_strong "Opinion on limiting immigration (strong views)"
tab immi3_strong

*** INTERNATIONAL COOPERATION (PROXY: EFFECTS OF BILATERALS ON LABOR MARKET)
* ==============================================================================

* Effect of EU bilateral agreements on the labor market
* --------------------------------------
/* Wie wirken sich die bilateralen Verträge Ihrer
Beurteilung nach auf die Situation auf dem
Arbeitsmarkt in der Schweiz aus?
1 Die Arbeitsmarktsituation verbessert sich deutlich
2 Die Arbeitsmarktsituation verbessert sich leicht
3 Weder noch
4 Die Arbeitsmarktsituation verschlechtert sich leicht
5 Die Arbeitsmarktsituation verschlechtert sich deutlich
*/
gen bil=W1_f15653
tab bil
label var bil "Effect bilaterals on labor market"
label val bil opinion

* Effect of EU bilateral agreements on the labor market (recoded in 3 categories)
gen bil3=bil
tab bil3
recode bil3 (1 2=3) (3=2) (4 5=1)
label val bil3 op3
label var bil3 "Effect bilaterals on labor market"

* ROBUSTNESS 1. A): "Strong views"
gen bil3_strong=bil
tab bil3_strong
recode bil3_strong (1=3) (2 3 4=2) (5=1)
label def bil3_strong 1 "negative" 2 "neutral" 3 "positive" 
label val bil3_strong bil3_strong
label var bil3_strong "Effect bilaterals on labor market (strong views)"
tab bil3_strong

* ROBUSTNESS 1. C): New measure for international cooperation

* Own opinion on additional bilateral treaties with EU 
* ===================================
/* Welche Meinung haben Sie zu den folgenden
politischen Forderungen?
Zusätzliche bilaterale Verträge mit der EU
1 Sehr dafür
2 Eher dafür
3 Weder noch
4 Eher dagegen
5 Sehr dagegen
*/

gen adbil=W1_f15340a
tab adbil
label var adbil "Opinion on additional bilateral treaties"
label val adbil opinion

* Own opinion on limiting immigration (recoded in 3 categories)
gen adbil3=adbil
tab adbil3
recode adbil3 (1 2=3) (3=2) (4 5=1)
label def adbil3 1 "negative" 2 "neutral" 3 "positive" 
label val adbil3 adbil3
label var adbil3 "Opinion on additional bilateral treaties"
tab adbil3

* CODING OF GROUPS (5 groups)
* ===============

gen immibil5=0 
replace immibil5=1 if immi<3 & bil>3 // nationalist: immigration neg, bilaterals neg
replace immibil5=2 if immi>3 & bil<3 // internationalist: immigration pos, bilaterals pos
replace immibil5=3 if immi>3 & bil>3 // altern. cross-pressured: immigration pos, bilaterals neg
replace immibil5=4 if immi<3 & bil<3 // cross-pressured: immigration neg, bilaterals pos
replace immibil5=. if immi==. | bil==. 
label var immibil5 "Opinion about immigration and bilateral treaties"
label def immibil5 1 "nationalist" 2 "internationalist" 3 "alternative cross-pressured" 4 "cross-pressured" 0 "neutral stance"
label val immibil5 immibil5
tab immibil5

* CODING OF GROUPS (9 groups)
* ===============

gen immibil9=9 
replace immibil9=1 if immi<3 & bil<3 // cross-pressured: immigration neg, bilaterals pos
replace immibil9=2 if immi<3 & bil>3 // nationalist: immigration neg, bilaterals neg
replace immibil9=3 if immi>3 & bil<3 // internationalist: immigration pos, bilaterals pos
replace immibil9=4 if immi>3 & bil>3 // altern. cross-pressured: immigration pos, bilaterals neg
replace immibil9=5 if immi<3 & bil==3 // G1 = immigration negative / bilaterals neutral = “leaning nationalist-protectionist”
replace immibil9=6 if immi==3 & bil>3 // G2 = immigration neutral / bilaterals negative = “leaning nationalist-protectionist”
replace immibil9=7 if immi>3 & bil==3 // G3 = immigration positive / bilaterals neutral = “leaning internationalist”
replace immibil9=8 if immi==3 & bil<3 // G4 = immigration neutral / bilaterals positive = “leaning internationalist”
replace immibil9=. if immi==. | bil==. 
label var immibil9 "Opinion about immigration and bilateral treaties"
label def immibil9 1 "cross-pressured" 2 "nationalist" 3 "internationalist" 4 "altern. cross-pressured"  5 "G1" 6 "G2" 7 "G3" 8 "G4"  9 "G5: true neutrals"
label val immibil9 immibil9
tab immibil9

* Identify cross-pressured group: likes bilaterals, but dislikes immigration
* ---------------------------------------------------------------------------
gen crosspressured1=immibil5==4
replace crosspressured1=. if immibil5==.
label var crosspressured1 "Cross-pressured group 1: Imm-neg,Bil-pos"
tab crosspressured1

*** 1. TRADE-OFF: IMMIGRATION VS BILATERALS
* =========================================

gen immi_bil=W1_f15655
label var immi_bil "Restrict immigration or maintain bilaterals?"
label def immi_bil 1 " restrict" 2 "rather restrict" 3 "rather maintain" 4 "maintain"
label val immi_bil immi_bil

gen biloverimmi=W1_f15655>2
replace biloverimmi=. if immi_bil==.
label var biloverimmi "Maintain bilaterals rather than limit immigration (dummy)"
label def biloverimmi 0 "Restrict immigration" 1 "Maintain bilaterals" 
label val biloverimmi biloverimmi

* ROBUSTNESS 1. A): "Strong views"
* CODING OF GROUPS (5 groups)
* ===============

gen immibil5_strong=0 
replace immibil5_strong=1 if immi3_strong>2 & bil3_strong<2 // nationalist: immigration neg, bilaterals neg
replace immibil5_strong=2 if immi3_strong<2 & bil3_strong>2 // internationalist: immigration pos, bilaterals pos
replace immibil5_strong=3 if immi3_strong<2 & bil3_strong<2 // altern. cross-pressured: immigration pos, bilaterals neg
replace immibil5_strong=4 if immi3_strong>2 & bil3_strong>2 // cross-pressured: immigration neg, bilaterals pos
replace immibil5_strong=. if immi3_strong==. | bil3_strong==. 
label var immibil5_strong "Opinion on immigration and bilateral treaties (strong views)"
label def immibil5_strong 1 "nationalist" 2 "internationalist" 3 "alternative cross-pressured" 4 "cross-pressured" 0 "neutral stance"
label val immibil5_strong immibil5_strong
tab immibil5_strong

* ROBUSTNESS 1. C): New measure for international cooperation
* CODING OF GROUPS (5 groups)
* ===============

gen immiadbil5=0 
replace immiadbil5=1 if immi3>2 & adbil3<2 // nationalist: immigration neg, bilaterals neg
replace immiadbil5=2 if immi3<2 & adbil3>2 // internationalist: immigration pos, bilaterals pos
replace immiadbil5=3 if immi3<2 & adbil3<2 // altern. cross-pressured: immigration pos, bilaterals neg
replace immiadbil5=4 if immi3>2 & adbil3>2 // cross-pressured: immigration neg, bilaterals pos
replace immiadbil5=. if immi3==. | adbil3==. 
label var immiadbil5 "Opinion on immigration and bilateral treaties (new measure)"
label def immiadbil5 1 "nationalist" 2 "internationalist" 3 "alternative cross-pressured" 4 "cross-pressured" 0 "neutral stance"
label val immiadbil5 immiadbil5
tab immiadbil5

********************************************************
** 2. TRADE-OFF: IDENTIFYING CROSS-PRESSURED CITIZENS **
** SOCIAL PROTECTION VS. INTERNATIONAL COOPERATION *****
********************************************************

*** ACCOMPANYING MEASURES (PROXY: OPINION ON SOCIAL PROTECTION)
* =============================================================

* Own opinion on state interventions vs. free market 
* --------------------------------------------------
/* Sind Sie für eine Schweiz mit mehr Staatseingriffen
in die Wirtschaft oder für eine Schweiz mit mehr
Wettbewerb auf dem Markt?
1 Sehr für mehr Staatseingriffe in die Wirtschaft
2 Eher für mehr Staatseingriffe in die Wirtschaft
3 Weder noch
4 Eher für mehr Wettbewerb auf dem Markt
5 Sehr für mehr Wettbewerb auf dem Markt
*/
gen inter=W1_f15435
recode inter (1=1) (2=0.75) (3=0.5) (4=0.25) (5=0)
label var inter "Opinion on state interventions"
tab inter


* Importance of social policy
* --------------------------------------------------
/* Wie wichtig sind für Sie die folgenden
Themenbereiche?
Sozialpolitik
1 Extrem wichtig
2 Sehr wichtig
3 Eher wichtig
4 Eher unwichtig
*/
gen sopo=W1_f15310c
recode sopo (1=1) (2=0.67) (3=0.33) (4=0)
label var sopo "Importance of social policy"
tab sopo


* Average view on social protection
* --------------------------------------
gen protectavg=(inter + sopo)/2 if !mi(inter, sopo)
label var protectavg "Average view of social protection"
tab protectavg

* Own opinion on social protection (recoded in 5 categories)
gen protect=3
replace protect=1 if protectavg>=0.8
replace protect=2 if protectavg>=0.6 & protectavg<0.8
replace protect=4 if protectavg>=0.2 & protectavg<0.4
replace protect=5 if protectavg>=0 & protectavg<0.2
replace protect=. if protectavg==.
label val protect opinion
label var protect "Opinion on social protection"
tab protect

* Own opinion on social protection (recoded in 3 categories)
gen protect3=protect
recode protect3 (1 2=3) (3=2) (4 5=1)
label val protect3 op3
label var protect3 "Opinion on social protection"

* ROBUSTNESS 1. A): "Strong views"
* Own opinion on social protection (recoded in 3 categories)
gen protect3_strong=protect
recode protect3_strong (1=3) (2 3 4=2) (5=1)
label val protect3_strong op3
label var protect3_strong "Opinion on social protection (strong views)"


* ROBUSTNESS 1. B): New measure for social protection

* Own opinion on social spending 
* ===================================
/* Sind Sie für eine Verringerung oder eine Erhöhung
der Sozialausgaben des Bundes?
1 Sehr für eine Verringerung
2 Eher für eine Verringerung
3 Weder noch
4 Eher für eine Erhöhung
5 Sehr für eine Erhöhung
*/

gen spend=W1_f15420
tab spend
recode spend (1=5) (2=4) (4=2) (5=1)
label var spend "Opinion on social spending"
label val spend opinion

* Own opinion on social spending (recoded in 3 categories)
gen spend3=spend
tab spend3
recode spend3 (1 2=3) (3=2) (4 5=1)
label def spend3 1 "negative" 2 "neutral" 3 "positive" 
label val spend3 adbil3
label var spend3 "Opinion on social spending"
tab spend3


*** SWISS-EU BILATERAL AGREEMENTS (PROXY: EFFECTS OF BILATERALS ON LABOR MARKET)
* ==============================================================================

* Effect of EU bilateral agreements on the labor market
* --------------------------------------
/* Wie wirken sich die bilateralen Verträge Ihrer
Beurteilung nach auf die Situation auf dem
Arbeitsmarkt in der Schweiz aus?
1 Die Arbeitsmarktsituation verbessert sich deutlich
2 Die Arbeitsmarktsituation verbessert sich leicht
3 Weder noch
4 Die Arbeitsmarktsituation verschlechtert sich leicht
5 Die Arbeitsmarktsituation verschlechtert sich deutlich
*/

* see variables "bil" and "bil3" created above

* CODING OF GROUPS (5 groups)
* ===============

gen protectbil5=0 
replace protectbil5=1 if protect<3 & bil>3 // protectionist: social protection pos (accompanying measures pos), bilaterals neg
replace protectbil5=2 if protect>3 & bil<3 // internationalist: social protection neg (accompanying measures neg), bilaterals pos
replace protectbil5=3 if protect>3 & bil>3 // altern. cross-pressured: social protection neg (accompanying measures neg), bilaterals neg
replace protectbil5=4 if protect<3 & bil<3 // cross-pressured: social protection pos (accompanying measures pos), bilaterals pos
replace protectbil5=. if protect==. | bil==. 
label def protectbil5 1 "protectionist" 2 "internationalist" 3 "alternative cross-pressured" 4 "cross-pressured" 0 "neutral stance"
label var protectbil5 "Opinion on social protection (accompanying measures) and bilaterals"
label val protectbil5 protectbil5
tab protectbil5

* CODING OF GROUPS (9 groups)
* ===============

gen protectbil9=9
replace protectbil9=1 if protect<3 & bil<3 // cross-pressured: social protection pos (accompanying measures pos), bilaterals pos
replace protectbil9=2 if protect<3 & bil>3 // protectionist: social protection pos (accompanying measures pos), bilaterals neg
replace protectbil9=3 if protect>3 & bil<3 // internationalist: social protection neg (accompanying measures neg), bilaterals pos
replace protectbil9=4 if protect>3 & bil>3 // altern. cross-pressured: social protection neg (accompanying measures neg), bilaterals neg
replace protectbil9=5 if protect<3 & bil==3 // G1 = social protection positive / bilaterals neutral = “leaning nationalist-protectionist”
replace protectbil9=6 if protect==3 & bil>3 // G2 = social protection neutral / bilaterals negative = “leaning nationalist-protectionist”
replace protectbil9=7 if protect>3 & bil==3 // G3 = social protection negative / bilaterals neutral = “leaning internationalist”
replace protectbil9=8 if protect==3 & bil<3 // G4 = social protection neutral / bilaterals positive = “leaning internationalist”
replace protectbil9=. if protect==. | bil==. 
label var protectbil9 "Opinion on social protection (accompanying measures) and bilaterals"
label def protectbil9 1 "cross-pressured" 2 "protectionist" 3 "internationalist" 4 "altern. cross-pressured"  5 "G1" 6 "G2" 7 "G3" 8 "G4" 9 "G5: true neutrals"
label val protectbil9 protectbil9
tab protectbil9


* Identify cross-pressured group: likes social protection (accompanying measures), but also likes bilaterals
* ----------------------------------------------------------------------------------------------------------
gen crosspressured2=protectbil5==4
replace crosspressured2=. if protectbil5==.
label var crosspressured2 "Cross-pressured group 2: Protect-pos,Bil-pos"
tab crosspressured2

*** 2. TRADE-OFF: ACCOMPANYING MEASURES (SOCIAL PROTECTION) VS INSTITUTIONAL AGREEMENT
* ==================================================================================

gen am_insta=W1_f15641
recode am_insta (1=4) (2=3) (3=2) (4=1)
label var am_insta "Maintain accompanying measures or accept InstA?"
label def am_insta 1 "maintain AM" 2 "rather maintain AM" 3 "rather accept InstA" 4 "accept InstA"  
label val am_insta am_insta

gen instaoveram=W1_f15641<3
replace instaoveram=. if am_insta==.
label var instaoveram "Accept InstA rather than maintain accompanying measures (dummy)"
label def instaoveram 0 "Maintain accompanying measures" 1 "Accept InstA" 
label val instaoveram instaoveram

* ROBUSTNESS 1. A): "Strong views"
* CODING OF GROUPS (5 groups)
* ===============

gen protectbil5_strong=0 
replace protectbil5_strong=1 if protect3_strong>2 & bil3_strong<2 // protectionist: social protection pos (accompanying measures pos), bilaterals neg
replace protectbil5_strong=2 if protect3_strong<2 & bil3_strong>2 // internationalist: social protection neg (accompanying measures neg), bilaterals pos
replace protectbil5_strong=3 if protect3_strong<2 & bil3_strong<2 // altern. cross-pressured: social protection neg (accompanying measures neg), bilaterals neg
replace protectbil5_strong=4 if protect3_strong>2 & bil3_strong>2 // cross-pressured: social protection pos (accompanying measures pos), bilaterals pos
replace protectbil5_strong=. if protect3_strong==. | bil3_strong==. 
label var protectbil5_strong "Opinion on social protection (accompanying measures) and bilaterals (strong views)"
label val protectbil5_strong protectbil5
tab protectbil5_strong

* ROBUSTNESS 1. B): New measure for social protection
* CODING OF GROUPS (5 groups)
* ===============

gen spendbil5=0 
replace spendbil5=1 if spend<3 & bil>3 // protectionist: social protection pos (accompanying measures pos), bilaterals neg
replace spendbil5=2 if spend>3 & bil<3 // internationalist: social protection neg (accompanying measures neg), bilaterals pos
replace spendbil5=3 if spend>3 & bil>3 // altern. cross-pressured: social protection neg (accompanying measures neg), bilaterals neg
replace spendbil5=4 if spend<3 & bil<3 // cross-pressured: social protection pos (accompanying measures pos), bilaterals pos
replace spendbil5=. if spend==. | bil==. 
label def spendbil5 1 "protectionist" 2 "internationalist" 3 "alternative cross-pressured" 4 "cross-pressured" 0 "neutral stance"
label var spendbil5 "Opinion on social protection (new measure) and bilaterals"
label val spendbil5 spendbil5
tab spendbil5

* ROBUSTNESS 1. C): New measure for international cooperation
* CODING OF GROUPS (5 groups)
* ===============

gen protectadbil5=0 
replace protectadbil5=1 if protect3>2 & adbil3<2 // protectionist: social protection pos (accompanying measures pos), bilaterals neg
replace protectadbil5=2 if protect3<2 & adbil3>2 // internationalist: social protection neg (accompanying measures neg), bilaterals pos
replace protectadbil5=3 if protect3<2 & adbil3<2 // altern. cross-pressured: social protection neg (accompanying measures neg), bilaterals neg
replace protectadbil5=4 if protect3>2 & adbil3>2 // cross-pressured: social protection pos (accompanying measures pos), bilaterals pos
replace protectadbil5=. if protect3==. | adbil3==. 
label var protectadbil5 "Opinion on social protection (accompanying measures) and bilaterals (new measure)"
label val protectadbil5 protectbil5
tab protectadbil5

****************************************************************
******************** OTHER RECODINGS ***************************
****************************************************************

*** VOTE INTENTION 2019 (W1)

gen svp=W1_f1085_90==40
replace svp=. if W1_f1085_90==.
label var svp "potential SVP voter"

gen sp=W1_f1085_90==30
replace sp=. if W1_f1085_90==.
label var sp "potential SP voter"

gen fdp=W1_f1085_90==10
replace fdp=. if W1_f1085_90==.
label var fdp "potential FDP voter"

gen cvp=W1_f1085_90==20
replace cvp=. if W1_f1085_90==.
label var cvp "potential CVP voter" 

gen gps=W1_f1085_90==50
replace gps=. if W1_f1085_90==.
label var gps "potential GPS voter" 

gen glp=W1_f1085_90==60
replace glp=. if W1_f1085_90==.
label var glp "potential GLP voter" 

gen bdp=W1_f1085_90==70
replace bdp=. if W1_f1085_90==.
label var bdp "potential BDP voter" 

gen lega=W1_f1085_90==80
replace lega=. if W1_f1085_90==.
label var lega "potential Lega voter" 

gen mcg=W1_f1085_90==90
replace mcg=. if W1_f1085_90==.
label var mcg "potential MCG voter" 

gen csp=W1_f1085_90==100
replace csp=. if W1_f1085_90==.
label var csp "potential CSP voter" 

gen evp=W1_f1085_90==110
replace evp=. if W1_f1085_90==.
label var evp "potential EVP voter" 

gen edu=W1_f1085_90==120
replace edu=. if W1_f1085_90==.
label var edu "potential EDU voter" 

gen pda=W1_f1085_90==130
replace pda=. if W1_f1085_90==.
label var pda "potential PdA voter" 

gen al=W1_f1085_90==140
replace al=. if W1_f1085_90==.
label var al "potential AL-Sol-EàG voter" 

gen otherparties=W1_f1085_90==350|W1_f1085_90==404
replace otherparties=. if W1_f1085_90==.
label var otherparties "other party/parties voter" 

gen otherpersons=W1_f1085_90==402
replace otherpersons=. if W1_f1085_90==.
label var otherpersons "persons not party voter" 

gen party6=1
replace party6=2 if W1_f1085_90==40 //svp
replace party6=3 if W1_f1085_90==10 //fdp
replace party6=4 if W1_f1085_90==20 //cvp
replace party6=5 if W1_f1085_90==60 //glp
replace party6=6 if W1_f1085_90==30 //sp
replace party6=7 if W1_f1085_90==50 //gps
replace party6=1 if W1_f1085_90>60 //no party
replace party6=1 if W1_f1085_90==.
label var party6 "major parties (categorical)"
label def party6 1 "other/no party" 2 "SVP" 3 "FDP" 4 "CVP" 5 "GLP" 6 "SP" 7 "GPS" 
label val party6 party6

gen party8=0
replace party8=2 if W1_f1085_90==40 //svp
replace party8=3 if W1_f1085_90==10 //fdp
replace party8=4 if W1_f1085_90==20 //cvp
replace party8=5 if W1_f1085_90==60 //glp
replace party8=6 if W1_f1085_90==30 //sp
replace party8=7 if W1_f1085_90==50 //gps
replace party8=1 if W1_f1085_90>60 & W1_f1085_90<=350 //other party
replace party8=1 if W1_f1085_90==404 //other party
label var party8 "major parties (categorical)"
label def party8 0 "no party" 1 "other party" 2 "SVP" 3 "FDP" 4 "CVP" 5 "GLP" 6 "SP" 7 "GPS" 
label val party8 party8

gen party4=0
replace party4=1 if W1_f1085_90==40 //svp
replace party4=2 if W1_f1085_90==10 //fdp
replace party4=3 if W1_f1085_90==20 //cvp
replace party4=4 if W1_f1085_90==30 //sp
replace party4=0 if W1_f1085_90>40 //other/no party
replace party4=0 if W1_f1085_90==.
label var party4 "major parties (categorical)"
label def party4  1 "SVP" 2 "FDP" 3 "CVP" 4 "SP" 0 "other/no party pref"
label val party4 party4


*** LEFT-RIGHT SELF-PLACEMENT
gen leftright=W1_f15200
replace leftright=. if W1_f15200>10
label var leftright "left-right self-placement"
label def leftright 0 "left" 10 "right"
label val leftright leftright


*** Party Identification (W1)
gen pisvp=W1_f14010rec==40
replace pisvp=. if W1_f14010rec==.
label var pisvp "SVP party identification" 

gen pisp=W1_f14010rec==30
replace pisp=. if W1_f14010rec==.
label var pisp "SP party identification"

gen pifdp=W1_f14010rec==10
replace pifdp=. if W1_f14010rec==.
label var pifdp "FDP party identification"

gen picvp=W1_f14010rec==20
replace picvp=. if W1_f14010rec==.
label var picvp "CVP party identification" 

gen pigps=W1_f14010rec==50
replace pigps=. if W1_f14010rec==.
label var pigps "GPS party identification" 

gen piglp=W1_f14010rec==60
replace piglp=. if W1_f14010rec==.
label var piglp "GLP party identification" 

gen piother=W1_f14010rec>=70&W1_f14010rec<=350
replace piother=. if W1_f14010rec==.
label var piother "Other party identification" 


*** PARTICIPATION (INTENTION TO TAKE PART IN ELECTION - W1)
gen turnout=. if W1_f10800 > 4
replace turnout=4 if W1_f10800==1
replace turnout=3 if W1_f10800==2
replace turnout=2 if W1_f10800==3
replace turnout=1 if W1_f10800==4
label var turnout "Intention to take part in national election 2019 (W1)"
label def turnout 1 "certainly not" 2 "rather not" 3 "rather sure" 4 "certain to participate"
label val turnout turnout


*** EDUCATION
gen education=W1_f21310
replace education=. if W1_f21310>13
label var education "Education level"

gen highskill=education>10
replace highskill=. if education==.

gen lowskill=education<6
replace lowskill=. if education==.


gen edu3=0
replace edu3=1 if education>5
replace edu3=2 if education>10
replace edu3=. if W1_f21310>13


*** GENDER/SEX (male=1)
gen male=W1_sex
replace male=0 if W1_sex==2
label var male "Male respondent"


*** AGE
g age=W1_age
label var age "Age (in years)"


*** COUNTRY OF BIRTH
gen switzerland=0 if !mi(birthcountry_sample)
replace switzerland=1 if birthcountry_sample==8100

gen eu28=0 if !mi(birthcountry_sample)
replace eu28=1 if birthcountry_sample>=8204 & birthcountry_sample<=8218
replace eu28=1 if birthcountry_sample>=8223 & birthcountry_sample<=8224
replace eu28=1 if birthcountry_sample==8227
replace eu28=1 if birthcountry_sample>=8229 & birthcountry_sample<=8234
replace eu28=1 if birthcountry_sample>=8236 & birthcountry_sample<=8238
replace eu28=1 if birthcountry_sample>=8240 & birthcountry_sample<=8244
replace eu28=1 if birthcountry_sample>=8250 & birthcountry_sample<=8251
replace eu28=1 if birthcountry_sample>=8260 & birthcountry_sample<=8262


*** RURAL v. URBAN
gen rural=0 if !mi(smt9)
replace rural=1 if smt9==31|smt9==32|smt9==33
label var rural "Resident of rural area"


*** GROSS MONTHLY HOUSEHOLD INCOME
gen income=W1_f28910
label var income "Gross monthly household income"


* income groups (~quartiles)
gen incgroup=.
replace incgroup=4 if W1_f28910<.
replace incgroup=3 if W1_f28910<10
replace incgroup=2 if W1_f28910<7
replace incgroup=1 if W1_f28910<5
label var incgroup "Income group (quartiles)"
label def incgroup 1 "low income" 2 "lower middle income" 3 "upper middle income" 4 "high income"
label val incgroup incgroup

*** WORK STATUS
gen fulltime=0 if W1_f21400<=8
replace fulltime=1 if W1_f21400==1

gen parttime=0 if W1_f21400<=8
replace parttime=1 if W1_f21400==2

gen training=0 if W1_f21400<=8
replace training=1 if W1_f21400==3

gen housemaker=0 if W1_f21400<=8
replace housemaker=1 if W1_f21400==4

gen retired=0 
replace retired=1 if W1_f21400==5
replace retired=. if W1_f21400>8
label var retired "Retired respondent"

gen invalidity=0 if W1_f21400<=8
replace invalidity=1 if W1_f21400==6

gen unemployed=0 if W1_f21400<=8
replace unemployed=1 if W1_f21400==7
label var unemployed "Unemployed respondent"

gen other=0 if W1_f21400<=8
replace other=1 if W1_f21400==8


*** POLICY ATTITUDES
label def policy 1 "certainly not" 2 "rather not" 3 "neither nor" 4 "rather for" 5 "strongly for"
*** IN FAVOR OF LIMITING IMMIGRATION
gen limitimmi=1 if W1_f15340b<9
replace limitimmi=2 if W1_f15340b==4
replace limitimmi=3 if W1_f15340b==3
replace limitimmi=4 if W1_f15340b==2
replace limitimmi=5 if W1_f15340b==1
label val limitimmi policy

*** IN FAVOR OF STRENGTHENING THE ECONOMIC COMPETITIVENESS
gen strengtheco=1 if W1_f15340e<9
replace strengtheco=2 if W1_f15340e==4
replace strengtheco=3 if W1_f15340e==3
replace strengtheco=4 if W1_f15340e==2
replace strengtheco=5 if W1_f15340e==1
label val strengtheco policy

*** IN FAVOR OF EU MEMBERSHIP
gen becomemember=1 if W1_f15430<9
replace becomemember=2 if W1_f15430==4
replace becomemember=3 if W1_f15430==3
replace becomemember=4 if W1_f15430==2
replace becomemember=5 if W1_f15430==1
label val becomemember policy


*** IMPORTANCE OF POLICIES
label def importance 1 "rather not important" 2 "rather important" 3 "very important" 4 "extremely important" 
*** IMPORTANCE OF EU POLICY
gen euimp=1 if W1_f15310a<9
replace euimp=2 if W1_f15310a==3
replace euimp=3 if W1_f15310a==2
replace euimp=4 if W1_f15310a==1
label val euimp importance
label var euimp "Importance of EU policy"

*** IMPORTANCE OF MIGRATION POLICY
gen migimp=1 if W1_f15310b<9
replace migimp=2 if W1_f15310b==3
replace migimp=3 if W1_f15310b==2
replace migimp=4 if W1_f15310b==1
label val migimp importance
label var migimp "Importance of migration policy"

*** IMPORTANCE OF ECONOMIC POLICY
gen ecoimp=1 if W1_f15310e<9
replace ecoimp=2 if W1_f15310e==3
replace ecoimp=3 if W1_f15310e==2
replace ecoimp=4 if W1_f15310e==1
label val ecoimp importance
label var ecoimp "Importance of economic policy"


*** ISSUE SALIENCY
*** MOST IMPORTANT PROBLEM: IMMIGRATION AND ASYLUM (first and second mentions)
gen sal_immi=0
replace sal_immi=1 if W1_f12700rec==8 //first mention - no observations dropped
replace sal_immi=1 if W1_f12730rec==8 //second mention - no observations dropped
label var sal_immi "Saliency of immigration"

*** MOST IMPORTANT PROBLEM: ECONOMY OR LABOR MARKET (first and second mentions)
gen sal_eco=0
replace sal_eco=1 if W1_f12700rec==2 //first mention - no observations dropped
replace sal_eco=1 if W1_f12700rec==10 //first mention - no observations dropped
replace sal_eco=1 if W1_f12730rec==2 //second mention - no observations dropped
replace sal_eco=1 if W1_f12730rec==10 //second mention - no observations dropped
label var sal_eco "Saliency of economics"

*** MOST IMPORTANT PROBLEM: EU AND EUROPE (first and second mentions)
gen sal_eu=0
replace sal_eu=1 if W1_f12700rec==5 //first mention - no observations dropped
replace sal_eu=1 if W1_f12730rec==5 //second mention - no observations dropped
label var sal_eu "Saliency of EU"


*** POLITICAL INTEREST
gen polint=1 if W1_f10100<5
replace polint=2 if W1_f10100==3
replace polint=3 if W1_f10100==2
replace polint=4 if W1_f10100==1
label def interest 1 "low" 2 "rather low" 3 "rather high" 4 "high" 
label val polint interest
label var polint "Political interest"


*** ATTENTION TO CAMPAIGN
gen attention=1 if W1_f10160<5
replace attention=2 if W1_f10160==3
replace attention=3 if W1_f10160==2
replace attention=4 if W1_f10160==1
label val attention interest
label var attention "Attention to campaign" 


*** FREQUENCY OF POLITICAL DISCUSSION LAST WEEK (in days)
gen frequency=W1_f13310 if W1_f13310<9
label var frequency "Frequency of political discussion"


alpha attention frequency // Cronbach's alpha is 0.51
factor attention frequency // Eigenvalue 0.60
gen information=(attention/4 + frequency/7)/2 if !mi(attention, frequency)
label var information "Political information" 

*** REGULAR PARTICIPANT
gen participation2015=0 if W1_f10200rec<9
replace participation2015=1 if W1_f10200rec==1

gen participationDD2019=0 if W1_f10750<9
replace participationDD2019=1 if W1_f10750==1

gen participationDD=(W1_f12500/10) if W1_f12500<90

alpha participation2015 participationDD2019 participationDD // Cronbach's alpha 0.75
factor participation2015 participationDD2019 participationDD 
rotate // Eigenvalue of 1.54, participation in 2015 election weakest link

gen participation=(participation2015 + participationDD2019 + participationDD)/3
label var participation "Regular political participant"


*** MEDIA CONSUMPTION (NEWS) - TOTAL (the more, the better)

*TV
gen newsa=1 if W1_f13400a<5
replace newsa=2 if W1_f13400a==3
replace newsa=3 if W1_f13400a==2
replace newsa=4 if W1_f13400a==1

*Newspapers
gen newsb=1 if W1_f13400b<5
replace newsb=2 if W1_f13400b==3
replace newsb=3 if W1_f13400b==2
replace newsb=4 if W1_f13400b==1

*Free newspapers
gen newsc=1 if W1_f13400c<5
replace newsc=2 if W1_f13400c==3
replace newsc=3 if W1_f13400c==2
replace newsc=4 if W1_f13400c==1

*Social media
gen newsd=1 if W1_f13400d<5
replace newsd=2 if W1_f13400d==3
replace newsd=3 if W1_f13400d==2
replace newsd=4 if W1_f13400d==1

*Online newssites
gen newse=1 if W1_f13400e<5
replace newse=2 if W1_f13400e==3
replace newse=3 if W1_f13400e==2
replace newse=4 if W1_f13400e==1

*Radio
gen newsf=1 if W1_f13400f<5
replace newsf=2 if W1_f13400f==3
replace newsf=3 if W1_f13400f==2
replace newsf=4 if W1_f13400f==1

gen news=(newsa+newsb+newsc+newsd+newse+newsf)/24 if (W1_f13400a<5 & W1_f13400b<5 & W1_f13400c<5 & W1_f13400d<5 & W1_f13400e<5 & W1_f13400f<5)
* All news forms, but lots of missings (1'289)
gen news_trad=(newsa+newsf+newsb)/12 if (W1_f13400a<5 & W1_f13400b<5 & W1_f13400f<5)
* Only TV/Radio news and newspapers (fewer missings: 907)
gen news_nontrad=(newsc+newsd+newse)/12 if (W1_f13400c<5 & W1_f13400d<5 & W1_f13400e<5)


*** PARTY MOST COMPETENT ON POLICY ISSUE
*** EU POLICY
gen fdp_eu=0 
gen cvp_eu=0
gen sps_eu=0
gen svp_eu=0
replace fdp_eu=1 if W1_f15330a==1
replace cvp_eu=1 if W1_f15330a==2
replace sps_eu=1 if W1_f15330a==3
replace svp_eu=1 if W1_f15330a==4

*** MIGRATION POLICY
gen fdp_mig=0 
gen cvp_mig=0
gen sps_mig=0
gen svp_mig=0
replace fdp_mig=1 if W1_f15330b==1
replace cvp_mig=1 if W1_f15330b==2
replace sps_mig=1 if W1_f15330b==3
replace svp_mig=1 if W1_f15330b==4

*** ECONOMIC POLICY
gen fdp_eco=0 
gen cvp_eco=0
gen sps_eco=0
gen svp_eco=0
replace fdp_eco=1 if W1_f15330e==1
replace cvp_eco=1 if W1_f15330e==2
replace sps_eco=1 if W1_f15330e==3
replace svp_eco=1 if W1_f15330e==4


* // class coding nach Oesch //
* Class16 (nur 13 weil alle self-employed in 1 klasse)
* Class8 (nur 7 weil alle self-employed in 1 klasse)
* wc (working class dummy)
* ------------------------------
* ------------------------------

gen isco_all99=W1_ISCO08prof


* 4.1 Recode education into three different levels
gen educ_level99=W1_f21310
replace educ_level99=1 if inlist(W1_f21310,1,2,3,4,5)
replace educ_level99=2 if inlist(W1_f21310,6,7,8,9,10)
replace educ_level99=3 if inlist(W1_f21310,11,12,13)
recode educ_level99 (14=.)
label define educ_level99 ///
1 "Less than upper secondary education" ///
2 "Upper secondary education" ///
3 "Tertiary education"
label values educ_level99 educ_level99
tab1 educ_level99


* 4.2 Recode self-employment / employer
gen selfem_level99=1
replace selfem_level99=2 if W1_f21500==4 | W1_f24900==4
replace selfem_level99=. if W1_f21500==. & W1_f24900==.
label define selfem_level99 ///
1 "Not self-employed" ///
2 "Self-empl" 
label values selfem_level99 selfem_level99 
tab1 selfem_level99

* 5. Recode classes to the 15-class schema
gen class16=.

* 5.1 Allocate self-employed to schema (klassen 1-4 in 1 (0), weil wir keine Angaben zu Anzahl Beschäftigter haben)
replace class16=0 if selfem_level99==2


* 5.2 Allocate employed managers and professionals (ISCO 1000-2470) to the schema
replace class16=5 if selfem_level99==1 & inrange(isco_all99,110, 1239)
replace class16=6 if selfem_level99==1 & inrange(isco_all99,1300, 1320)
replace class16=9 if selfem_level99==1 & inrange(isco_all99,2100, 2213)
replace class16=13 if selfem_level99==1 & inrange(isco_all99,2220, 2321)
replace class16=14 if selfem_level99==1 & inrange(isco_all99,2330, 2332)
replace class16=13 if selfem_level99==1 & inrange(isco_all99,2340, 2359)
replace class16=5 if selfem_level99==1 & inrange(isco_all99,2410, 2429)
replace class16=14 if selfem_level99==1 & inrange(isco_all99,2430, 2432)
replace class16=13 if selfem_level99==1 & isco_all99==2440
replace class16=5 if selfem_level99==1 & isco_all99==2441
replace class16=13 if selfem_level99==1 & inrange(isco_all99,2442, 2443)
replace class16=14 if selfem_level99==1 & isco_all99==2444
replace class16=13 if selfem_level99==1 & isco_all99==2445
replace class16=14 if selfem_level99==1 & inrange(isco_all99,2446, 2450)
replace class16=13 if selfem_level99==1 & isco_all99==2451
replace class16=14 if selfem_level99==1 & inrange(isco_all99,2452, 2455)
replace class16=13 if selfem_level99==1 & isco_all99==2460
replace class16=5 if selfem_level99==1 & isco_all99==2470


* 5.3 Allocate employed associate managers and semi-professionals (ISCO 3000) to the schema
replace class16=10 if selfem_level99==1 & isco_all99==100
replace class16=10 if selfem_level99==1 & inrange(isco_all99,3100, 3152)
replace class16=14 if selfem_level99==1 & isco_all99==3200
replace class16=10 if selfem_level99==1 & inrange(isco_all99,3210, 3213)
replace class16=14 if selfem_level99==1 & inrange(isco_all99,3220, 3224)
replace class16=15 if selfem_level99==1 & isco_all99==3225
replace class16=14 if selfem_level99==1 & isco_all99==3226
replace class16=15 if selfem_level99==1 & inrange(isco_all99,3227, 3228)
replace class16=14 if selfem_level99==1 & inrange(isco_all99,3229, 3340)
replace class16=6 if selfem_level99==1 & inrange(isco_all99,3400, 3433)
replace class16=10 if selfem_level99==1 & isco_all99==3434
replace class16=6 if selfem_level99==1 & inrange(isco_all99,3440, 3450)
replace class16=14 if selfem_level99==1 & inrange(isco_all99,3460, 3472)
replace class16=15 if selfem_level99==1 & inrange(isco_all99,3473, 3475)
replace class16=14 if selfem_level99==1 & isco_all99==3480


* 5.4 Allocate specific occupations to the schema

*Professional military forces (isco 100) to associate managers 
replace class16=6 if selfem_level99==1 & isco_all99==100

*Locomotive engine drivers to technicians
replace class16=10 if selfem_level99==1 & inlist(isco_all99,8310,8311)

*Police officers to associate managers
replace class16=6 if selfem_level99==1 & isco_all99==5162

*Bus and tram drivers to skilled and routine service workers
replace class16=15 if selfem_level99==1 & isco_all99==8323


* 5.5 Allocate intermediate occupations to the schema (ISCO 4000-8340) and correct for skilled/unskilled (with/without upper secondary education)
replace class16=7 if selfem_level99==1 & educ_level99!=1 & inrange(isco_all99,4000, 4223)
replace class16=8 if selfem_level99==1 & educ_level99==1 & inrange(isco_all99,4000, 4223)
replace class16=15 if selfem_level99==1 & educ_level99!=1 & inlist(isco_all99,5160, 5169)
replace class16=16 if selfem_level99==1 & educ_level99==1 & inlist(isco_all99,5160, 5169)
replace class16=7 if selfem_level99==1 & inlist(isco_all99,5161, 5163)

replace class16=15 if selfem_level99==1 & educ_level99!=1 & inrange(isco_all99,5000, 5132)
replace class16=16 if selfem_level99==1 & educ_level99==1 & inrange(isco_all99,5000, 5132)
replace class16=16 if selfem_level99==1 & inlist(isco_all99,5133, 5139)
replace class16=15 if selfem_level99==1 & educ_level99!=1 & inlist(isco_all99,5140, 5141, 5143)
replace class16=16 if selfem_level99==1 & educ_level99==1 & inlist(isco_all99,5140, 5141, 5143)
replace class16=16 if selfem_level99==1 & inlist(isco_all99,5142, 5149)
replace class16=15 if selfem_level99==1 & educ_level99!=1 & inrange(isco_all99,5200, 5220)
replace class16=16 if selfem_level99==1 & educ_level99==1 & inrange(isco_all99,5200, 5220)

replace class16=11 if selfem_level99==1 & educ_level99!=1 & inrange(isco_all99,6000, 6154)
replace class16=12 if selfem_level99==1 & educ_level99==1 & inrange(isco_all99,6000, 6154)

replace class16=11 if selfem_level99==1 & educ_level99!=1 & inrange(isco_all99,7000, 7442)
replace class16=12 if selfem_level99==1 & educ_level99==1 & inrange(isco_all99,7000, 7442)

replace class16=11 if selfem_level99==1 & educ_level99!=1 & inrange(isco_all99,8000, 8279)
replace class16=12 if selfem_level99==1 & educ_level99==1 & inrange(isco_all99,8000, 8279)
replace class16=12 if selfem_level99==1 & inrange(isco_all99,8280, 8300)
replace class16=11 if selfem_level99==1 & educ_level99!=1 & isco_all99==8312
replace class16=12 if selfem_level99==1 & educ_level99==1 & isco_all99==8312
replace class16=12 if selfem_level99==1 & inrange(isco_all99,8320, 8322)
replace class16=11 if selfem_level99==1 & educ_level99!=1 & inrange(isco_all99,8323, 8324)
replace class16=12 if selfem_level99==1 & educ_level99==1 & inrange(isco_all99,8323, 8324)
replace class16=12 if selfem_level99==1 & isco_all99==8330
replace class16=11 if selfem_level99==1 & educ_level99!=1 & inrange(isco_all99,8331, 8340)
replace class16=12 if selfem_level99==1 & educ_level99==1 & inrange(isco_all99,8331, 8340)


*5.5 Allocate elementary occupations (ISCO 9000-9330 )
replace class16=16 if selfem_level99==1 & inrange(isco_all99,9100, 9152)
replace class16=12 if selfem_level99==1 & inrange(isco_all99,9153, 9330)


*5.6 Occupations impossible to allocate to a given class
replace class16=. if selfem_level99==1 & isco_all99==2000
replace class16=. if selfem_level99==1 & isco_all99==3000

label define class16 ///
0 "Self-employed (with and without employees)" ///
5 "Managers and administrators" ///
6 "Associate managers and administrators" ///
7 "Skilled clerks" ///
8 "Routine clerks" ///
9 "Technical experts" ///
10 "Technicians" ///
11 "Skilled craft workers" ///
12 "Routine operatives" ///
13 "Socio-cultural professionals" ///
14 "Socio-cultural semi-professionals" ///
15 "Skilled service workers" ///
16 "Routine service workers" ///
17 "other"
label values class16 class16
tab1 class16


* Alternative class variable - no class information available as separate category, not missing
gen class16alt = class16
replace class16alt=17 if class16==.
label val class16alt class16
tab class16alt

*6. Merge 16-class schema into the simplified 8-class version
recode class16 (0=0)(5/6=3)(7/8=4)(9/10=5)(11/12=6)(13/14=7)(15/16=8), gen(class8)

label define class8 ///
0 "Self-employed with and without employees" ///
3 "(Associate) managers and administrators" ///
4 "Office clerks" ///
5 "Technical professionals and technicians" ///
6 "Production workers" ///
7 "Socio-cultural (semi-)professionals" ///
8 "Service workers" ///
9 "other"
label values class8 class8

tab1 class8


* Alternative class variable - no class information available as separate category, not missing
gen class8alt = class8
replace class8alt=9 if class8==.
label val class8alt class8
tab class8alt


* Merge 8-class schema into a working class dummy
recode class8 (0=0)(3=0)(5=0)(7=0)(4=1)(6=1)(8=1), gen(wc)

label define wc ///
0 "not working class" ///
1 "working class"
label values wc wc

tab1 wc


* Tradables
* ------------------
* Tradables industry
gen tradables=0
replace tradables =	1	if W1_f21750==	1
replace tradables =	1	if W1_f21750==	2
replace tradables =	0	if W1_f21750==	3
replace tradables =	1	if W1_f21750==	4
replace tradables =	0	if W1_f21750==	5
replace tradables =	0	if W1_f21750==	6
replace tradables =	1	if W1_f21750==	7
replace tradables =	1	if W1_f21750==	8
replace tradables =	1	if W1_f21750==	9
replace tradables =	1	if W1_f21750==	10
replace tradables =	0	if W1_f21750==	11
replace tradables =	1	if W1_f21750==	12
replace tradables =	0	if W1_f21750==	13
replace tradables =	1	if W1_f21750==	14
replace tradables = .   if W1_f21750==	15
replace tradables = .   if W1_f21750==	.
label var tradables "tradable sector"

* More power in Swiss-EU negotiations
* -----------------------------------
* Negotiation power
gen power=W1_f15643
recode power (2=3) (3=2)
label var power "More power in Swiss-EU negotiations"
label define power 1 "CH" 2 "both to equal extent" 3 "EU"
label values power power

* Trade Union Member
* --------------------------------
* Member of Trade Union yes / no
gen memberTU=W3_n13_030a1
recode memberTU (8=.)
label var memberTU "Member of Trade Union"
label define memberTU 0 "no" 1 "yes" 
label values memberTU memberTU


* Trade Union (either member, participated in activities, donated money or hold honorary position)
* ------------------------------------------------------------------------------------------------
* Somehow involved in Trade Union yes / no
gen tradeunion=.
replace tradeunion=1 if W3_n13_030a1==1 | W3_n13_030a2==1 | W3_n13_030a3==1 | W3_n13_030a4==1
replace tradeunion=0 if W3_n13_030a1==0 & W3_n13_030a2==0 & W3_n13_030a3==0 & W3_n13_030a4==0
label var tradeunion "Involved in Trade Union"
label define tradeunion 0 "no" 1 "yes" 
label values tradeunion tradeunion

* Perception of national economic situation in one year's time
* -------------------------------------------------------------
gen percecon=W1_f15656
recode percecon (1=5) (2=4) (4=2) (5=1)
lab var percecon "Perception of national economic situation in one year"
label define percecon 1 "significantly worse" 2 "rather worse" 3 "remain the same" 4 "rather better" 5 "significantly better"
label values percecon percecon

gen percecon3=percecon
recode percecon3 (1 2=1) (3=2) (4 5=3)
lab var percecon3 "Expected economic situation in 1 year"
label define percecon3 1 "worse" 2 "same" 3 "better"
label values percecon3 percecon3

* Labels
* -------------------------------
* Label variables for better graphical presentation
label var euimp "Importance of EU"
label var migimp "Importance of migration"
label var ecoimp "Importance of economy"


*****************************************************************************************
**** PART 2: ANALYSES FOR 1. TRADE-OFF **************************************************
*****************************************************************************************

***************************************
*** Part I: Who Is Cross-Pressured? ***
***************************************

/* 
---------------------------------------------
PART 1: Identifying the cross-pressured
---------------------------------------------
We use the values of individuals' assessment of immigration and the
bilateral treaties and define those as cross-pressured who believe immigration
is bad (immi3=3) and bilaterals are good (bil3=3). */

	
**********************************************************************************
* Figure 1: Relative Shares of Attitudinal Groups – Control-Cooperation Trade-Off
**********************************************************************************

tab immi3
tab bil3

* Graph Frequencies (all subgroups)

tab immi3 bil3, cell // 16.7% cross-pressured

gen labelspine="14% internationalists"
replace labelspine="(leaning internationalist)" if bil3==3 & immi3==2
replace labelspine="17% potentially cross-pressured" if bil3==3 & immi3==3
replace labelspine="(leaning internationalist)" if bil3==2 & immi3==1
replace labelspine="52% neutrals" if bil3==2 & immi3==2
replace labelspine="(leaning nationalist)" if bil3==2 & immi3==3
replace labelspine="2% altern. cr.-pr." if bil3==1 & immi3==1
replace labelspine="(leaning nationalist)" if bil3==1 & immi3==2
replace labelspine="16% nationalists" if bil3==1 & immi3==3

spineplot  immi3 bil3, legend(col(1) pos(3)) ///
	perce  text(labelspine)

**********************************************************************************
* Table 1: Control-Cooperation Trade-Off by Party (in Percent)
**********************************************************************************

* 5 groups
tab party6 immibil5, row

**********************************************************************************
* Table A2: Control-Cooperation Trade-Off: Neutrals Split up in Subgroups by Party 
* (in Percent of all Respondents), 2015 and 2019
*
* --> this is only the 2019 part of Table A2!
**********************************************************************************

* 9 groups
tab party6 immibil9, row

************************************************
*** Part II: What Determines Policy Choices? ***
************************************************

tab biloverimmi immibil5, col

*************************************************************************************************
* Table 3: Preferences of Potentially Cross-Pressured and Neutral Voters When Facing the 
* Trade-Offs (in Percent) 
*
* --> this is only the "Control-Cooperation Trade-Off" part of Table 3!
*************************************************************************************************

* cross-pressured
tab party6 biloverimmi if immibil5==4, row
* neutrals (total)
tab party6 biloverimmi if immibil5==0, row

* Subgroups of neutrals
* G1
tab party6 biloverimmi if immibil9==5, row
* G2
tab party6 biloverimmi if immibil9==6, row
* G3
tab party6 biloverimmi if immibil9==7, row
* G4
tab party6 biloverimmi if immibil9==8, row
* G5
tab party6 biloverimmi if immibil9==0, row

* share of cross-pressured and neutral voters among all party supporters
tab party6 immibil5,m row


*****************************************************************************************
**** PART 3: ANALYSES FOR 2. TRADE-OFF **************************************************
*****************************************************************************************

***************************************
*** Part I: Who Is Cross-Pressured? ***
***************************************

/* 
---------------------------------------------
PART 1: Identifying the cross-pressured
---------------------------------------------
We use the values of individuals' assessment of social protection (as a proxy for accompanying measures) 
and the bilateral treaties and define those as cross-pressured who think that social protection
is positive (protect3=3) and bilaterals are good (bil3=3). */

	
**********************************************************************************
* Figure 2: Relative Shares of Attitudinal Groups – Protection-Cooperation Trade-Off
**********************************************************************************

tab protect3
tab bil3

* Graph Frequencies (all subgroups)

tab protectbil5
tab protect3 bil3, cell // 16.5% cross-pressured

drop labelspine
gen labelspine="7% internationalists"
replace labelspine="(leaning internationalist)" if bil3==3 & protect3==2
replace labelspine="17% potentially cross-pressured" if bil3==3 & protect3==3
replace labelspine="4% altern. cr.-pr." if bil3==1 & protect3==1
replace labelspine="(leaning protectionist)" if bil3==1 & protect3==2
replace labelspine="9% protectionists" if bil3==1 & protect3==3
replace labelspine="(leaning internationalist)" if bil3==2 & protect3==1
replace labelspine="64% neutrals" if bil3==2 & protect3==2
replace labelspine="(leaning protectionist)" if bil3==2 & protect3==3
spineplot  protect3 bil3, legend(col(1) pos(3)) ///
	perce  text(labelspine)
	
**********************************************************************************
* Table 2: Protection-Cooperation Trade-Off by Party (in Percent)
**********************************************************************************

* 5 groups
tab party6 protectbil5, row

**********************************************************************************
* Table A3: Protection-Cooperation Trade-Off: Neutrals Split up in Subgroups by 
* Party (in Percent of all Respondents), 2019 
**********************************************************************************

* 9 groups
tab party6 protectbil9, row


**********************************************************************************
* Trade Union Involvement 
**********************************************************************************	
	
* Involvement in Trade Union yes
tab protectbil5 if tradeunion==1

* Involvement in Trade Union no
tab protectbil5 if tradeunion==0

* Member of Trade Union yes
tab protectbil5 if memberTU==1

* Member of Trade Union no
tab protectbil5 if memberTU==0

* According to political parties
tab protectbil5 party6 if tradeunion==1, col
tab protectbil5 party6 if tradeunion==0, col
tab protectbil5 party6 if memberTU==1, col
tab protectbil5 party6 if memberTU==0, col

**********************************************************************************
* Are the differences statistically significant (for example 34% cross-pressured
* voters among SP vs. 43% among SP voters that have a trade-union involvement? 
**********************************************************************************	

* SP
ci mean crosspressured2 if party6==5 & tradeunion==1
ci mean crosspressured2 if party6==5

* GPS
ci mean crosspressured2 if party6==6 & tradeunion==1
ci mean crosspressured2 if party6==6

************************************************
*** Part II: What Determines Policy Choices? ***
************************************************

tab instaoveram protectbil5, col

*************************************************************************************************
* Table 3: Preferences of Potentially Cross-Pressured and Neutral Voters When Facing the 
* Trade-Offs (in Percent) 
*
* --> this is only the "Protection-Cooperation Trade-Off" part of Table 3!
*************************************************************************************************

* cross-pressured
tab party6 instaoveram if protectbil5==4, row
* neutral (total)
tab party6 instaoveram if protectbil5==0, row

* Subgroups of neutrals
* G1
tab party6 instaoveram if protectbil9==5, row
* G2
tab party6 instaoveram if protectbil9==6, row
* G3
tab party6 instaoveram if protectbil9==7, row
* G4
tab party6 instaoveram if protectbil9==8, row
* G5
tab party6 instaoveram if protectbil9==0, row

* share of cross-pressured and neutral voters among all party supporters
tab party6 protectbil5,m row


*****************************************************************************************
**** PART 4: MULTIVARIATE ORDERED LOGISTIC REGRESSION MODELS FOR TABLE A4 ***************
*****************************************************************************************

**********************************************************************************
* Table A4: Determinants of Choice: Probability that Potentially Cross-Pressured 
* and Neutral Voters Prefer Maintaining the Bilateral Treaties Over Limiting 
* Immigration and the Institutional Framework Agreement Over the Flanking Measures 
* (Ordered Logistic Regression Models)
**********************************************************************************

**********************************************************************************
* Preference for Bilaterals over Limits on Immigration
* (A) Cross-pressured Voters
**********************************************************************************

* SP=ref
ologit immi_bil ib6.party6 male age education income rural retired unemployed polint attention participation if immibil5==4	
estimates store model1
coefplot,  keep(1.party6 2.party6 3.party6 4.party6 5.party6 7.party6) ///
    title("Preference to Maintain Bilateral Treaties" " " "Cross-Pressured Voters" " ", size(medium) span) ///
	xline(0)   xtitle("Marginal effects", size(small)) legend(off) ///
	ylabel(, labsize(small)) xlabel(, labsize(small)) ///
	horizontal recast(scatter)  drop(_cons) baselevels name(sp_a)
outreg using modelA.doc, varlabels replace starlevels(10 5 1 0.1) sigsymbols(+,*,**,***) summstat(N \ r2_a)

**********************************************************************************
* Preference for Bilaterals over Limits on Immigration
* (B) Neutral Voters
**********************************************************************************

* SP=ref
ologit immi_bil ib6.party6 male age education income rural retired unemployed polint attention participation if immibil5==0	
estimates store model1
coefplot,  keep(1.party6 2.party6 3.party6 4.party6 5.party6 7.party6) ///
    title(" " " " "Neutral Voters" " ", size(medium) span) ///
	xline(0)   xtitle("Marginal effects", size(small)) legend(off) ///
	ylabel(, labsize(small)) xlabel(, labsize(small)) ///
	horizontal recast(scatter)  drop(_cons) baselevels name(sp_b)
outreg using modelB.doc, varlabels replace starlevels(10 5 1 0.1) sigsymbols(+,*,**,***) summstat(N \ r2_a)

**********************************************************************************
* Preference for InstA over Flanking Measures
* (C) Cross-pressured Voters
**********************************************************************************

* SP=ref
ologit am_insta ib6.party6 male age education income rural retired unemployed polint attention participation tradeunion if protectbil5==4	
estimates store model1
coefplot,  keep(1.party6 2.party6 3.party6 4.party6 5.party6 7.party6) ///
    title("Preference to Accept Institutional Agreement" " " "Cross-Pressured Voters" " ", size(medium) span) ///
	xline(0)   xtitle("Marginal effects", size(small)) legend(off) ///
	ylabel(, labsize(small)) xlabel(, labsize(small)) ///
	horizontal recast(scatter)  drop(_cons) baselevels name(sp_c)
outreg using modelC.doc, varlabels replace starlevels(10 5 1 0.1) sigsymbols(+,*,**,***) summstat(N \ r2_a)
	
**********************************************************************************
* Preference for InstA over Flanking Measures
* (D) Neutral Voters
**********************************************************************************

* SP=ref
ologit am_insta ib6.party6 male age education income rural retired unemployed polint attention participation tradeunion if protectbil5==0	
estimates store model1
coefplot,  keep(1.party6 2.party6 3.party6 4.party6 5.party6 7.party6) ///
    title(" " " " "Neutral Voters" " ", size(medium) span) ///
	xline(0)   xtitle("Marginal effects", size(small)) legend(off) ///
	ylabel(, labsize(small)) xlabel(, labsize(small)) ///
	horizontal recast(scatter)  drop(_cons) baselevels name(sp_d)
outreg using modelD.doc, varlabels replace starlevels(10 5 1 0.1) sigsymbols(+,*,**,***) summstat(N \ r2_a)

graph combine sp_a sp_b sp_c sp_d, xsize(5)


*****************************************************************************************
**** PART 5: ROBUSTNESS-CHECKS **********************************************************
*****************************************************************************************

* Original outcomes
********************
* Table 1 
tab party6 immibil5, row
* Table 2
tab party6 protectbil5, row
* Table 3
* cross-pressured
tab party6 biloverimmi if immibil5==4, row
* neutrals (total)
tab party6 biloverimmi if immibil5==0, row
* cross-pressured
tab party6 instaoveram if protectbil5==4, row
* neutral (total)
tab party6 instaoveram if protectbil5==0, row
* Table A2
tab party6 immibil9, row
* Table A3
tab party6 protectbil9, row

* 1. A) Different Cut-Off Points / Larger Middle Category ("strong views")
**************************************************************************

**********************************************************************************
* Table B4: Control-Cooperation Trade-Off by Party (in Percent) Using Different 
* Cut-Off Points (Only Respondents with “Very Strong Views” in Positive and Negative 
* Category for Each Dimension) (Robustness Check for Table 1 in Research Note)
**********************************************************************************
tab party6 immibil5_strong, row

**********************************************************************************
* Table B5: Protection-Cooperation Trade-Off by Party (in Percent) Using Different 
* Cut-Off Points (Only Respondents with “Very Strong Views” in Positive and Negative
* Category for Each Dimension) (Robustness Check for Table 2 in Research Note)
**********************************************************************************
tab party6 protectbil5_strong, row

* 1. B) Alternative measure for social protection (social spending)
*******************************************************************

**********************************************************************************
* Table B6: Protection-Cooperation Trade-Off by Party (in Percent) Using an Alternative 
* Measure for the “Social Protection Dimension” (Attitudes Towards Social Spending) 
* (Robustness Check for Table 2 in Research Note)
**********************************************************************************
tab party6 spendbil5, row

**********************************************************************************
* Table B7: Preferences of Potentially Cross-Pressured and Neutral Voters When 
* Facing the Protection-Cooperation Trade-Off (in Percent) Using an Alternative 
* Measure for the “Social Protection Dimension” (Attitudes Towards Social Spending) 
* (Robustness Check for Table 3 in Research Note)
**********************************************************************************

* cross-pressured
tab party6 instaoveram if spendbil5==4, row
* neutral (total)
tab party6 instaoveram if spendbil5==0, row

* 1. C) Alternative measure for international cooperation (additional bilateral treaties)
*****************************************************************************************

**********************************************************************************
* Table B1: Control-Cooperation Trade-Off by Party (in Percent) Using an Alternative 
* Measure for the “International Cooperation Dimension” (Attitudes Towards Additional 
* Bilateral Agreements With the EU) (Robustness Check for Table 1 in Research Note) 
**********************************************************************************
tab party6 immiadbil5, row

**********************************************************************************
* Table B2: Protection-Cooperation Trade-Off by Party (in Percent) Using an 
* Alternative Measure for the “International Cooperation Dimension” (Attitudes 
* Towards Additional Bilateral Agreements With the EU) (Robustness Check for Table 
* 2 in Research Note)
**********************************************************************************
tab party6 protectadbil5, row

**********************************************************************************
* Table B3: Preferences of Potentially Cross-Pressured and Neutral Voters When 
* Facing the Trade-Offs (in Percent) Using an Alternative Measure for the “International 
* Cooperation Dimension” (Attitudes Towards Additional Bilateral Agreements With the EU) 
* (Robustness Check for Table 3 in Research Note)
**********************************************************************************
* cross-pressured
tab party6 biloverimmi if immiadbil5==4, row
* neutrals (total)
tab party6 biloverimmi if immiadbil5==0, row
* cross-pressured
tab party6 instaoveram if protectadbil5==4, row
* neutrals (total)
tab party6 instaoveram if protectadbil5==0, row


* 2. A) What are the determinants of being cross-pressured?
***********************************************************

* Control-Cooperation-Trade-Off

**********************************************************************************
* Table B8: Determinants of Being Potentially Cross-Pressured in the 
* Control-Cooperation Trade-Off (See Last Column) Using a Multinomial Logistic 
* Regression Model (Base Outcome: Neutral Voters)
**********************************************************************************
mlogit immibil5 male age education income unemployed retired polint participation i.party6 , baseoutcome(0)
estimates store model1
outreg2 using model1.doc, stats(coef se) paren(se) aster(coef) dec(2) alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) addstat(pseudo R2, e(r2_p), Log pseudolikelihood, e(ll)) replace		

* Protection-Cooperation-Trade-Off

**********************************************************************************
* Table B9: Determinants of Being Potentially Cross-Pressured in the 
* Protection-Cooperation Trade-Off (See Last Column) Using a Multinomial Logistic 
* Regression Model (Base Outcome: Neutral Voters)
**********************************************************************************

mlogit protectbil5 male age education income unemployed retired polint participation i.party6 tradeunion, baseoutcome(0)
estimates store model2
outreg2 using model2.doc, stats(coef se) paren(se) aster(coef) dec(2) alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) addstat(pseudo R2, e(r2_p), Log pseudolikelihood, e(ll)) replace
		

*****************************************************************************************
**** PART 6: DYNAMICS OVER TIME (CHANGES IN THE CONTROL-COOPERATION *********************
**** TRADE-OFF BETWEEN 2015 AND 2019) ***************************************************
*****************************************************************************************


****************************
******* Recodings **********
****************************

*******************************************************
*** Dataset: 828_Selects2015_PanelRCS_Data_v1.1.dta ***
*******************************************************

clear
set more off
use "...\828_Selects2015_PanelRCS_Data_v1.1.dta"

********************************************************
** 1. TRADE-OFF: IDENTIFYING CROSS-PRESSURED CITIZENS **
******** IMMIGRATION CONTROL VS. BILATERALS ************
********************************************************

*** IMMIGRATION
* ====================
label def opinion 1 "very pos." 2 "rather pos." 3 "neither" 4 "rather neg." 5 "very neg."

* Own opinion on limiting immigration 
* ===================================
/* Welche Meinung haben Sie zu den folgenden
politischen Forderungen?
Begrenzung der Zuwanderung
1 Sehr dafür
2 Eher dafür
3 Weder noch
4 Eher dagegen
5 Sehr dagegen
*/
gen immi=f15340b
tab immi
label var immi "Opinion on limiting immigration"
label val immi opinion

* Own opinion on limiting immigration (recoded in 3 categories)
gen immi3=immi
tab immi3
recode immi3 (1 2=3) (3=2) (4 5=1)
label def op3 1 "negative" 2 "neutral" 3 "positive" 
label val immi3 op3
label var immi3 "Opinion on limiting immigration (3)"

*** SWISS-EU BILATERAL AGREEMENTS (PROXY: EFFECTS OF BILATERALS ON LABOR MARKET)
* ==============================================================================

* Effect of EU bilateral agreements on the labor market
* --------------------------------------
/* Wie wirken sich die bilateralen Verträge Ihrer
Beurteilung nach auf die Situation auf dem
Arbeitsmarkt in der Schweiz aus?
1 Die Arbeitsmarktsituation verbessert sich deutlich
2 Die Arbeitsmarktsituation verbessert sich leicht
3 Weder noch
4 Die Arbeitsmarktsituation verschlechtert sich leicht
5 Die Arbeitsmarktsituation verschlechtert sich deutlich
*/
gen bil=f15653
tab bil
label var bil "Effect bilaterals on labor market"
label val bil opinion

* Effect of EU bilateral agreements on the labor market (recoded in 3 categories)
gen bil3=bil
tab bil3
recode bil3 (1 2=3) (3=2) (4 5=1)
label val bil3 op3
label var bil3 "Effect bilaterals on labor market (3)"

* CODING OF GROUPS (5 groups)
* ===============

gen immibil5=0 
replace immibil5=1 if immi<3 & bil>3 // nationalist: immigration neg, bilaterals neg
replace immibil5=2 if immi>3 & bil<3 // internationalist: immigration pos, bilaterals pos
replace immibil5=3 if immi>3 & bil>3 // altern. cross-pressured: immigration pos, bilaterals neg
replace immibil5=4 if immi<3 & bil<3 // cross-pressured: immigration neg, bilaterals pos
replace immibil5=. if immi==. | bil==. 
label var immibil5 "Opinion about immigration and bilateral treaties"
label def immibil 1 "nationalist" 2 "internationalist" 3 "alternative cross-pressured" 4 "cross-pressured" 0 "neutral stance"
label val immibil5 immibil
tab immibil5


* CODING OF GROUPS (9 groups)
* ===============

gen immibil9=0 
replace immibil9=1 if immi<3 & bil>3 // nationalist: immigration neg, bilaterals neg
replace immibil9=2 if immi>3 & bil<3 // internationalist: immigration pos, bilaterals pos
replace immibil9=3 if immi>3 & bil>3 // altern. cross-pressured: immigration pos, bilaterals neg
replace immibil9=4 if immi<3 & bil<3 // cross-pressured: immigration neg, bilaterals pos
replace immibil9=5 if immi<3 & bil==3 // G1 = immigration negative / bilaterals neutral
replace immibil9=6 if immi>3 & bil==3 // G2 = immigration positive / bilaterals neutral
replace immibil9=7 if immi==3 & bil<3 // G3 = immigration neutral / bilaterals positive
replace immibil9=8 if immi==3 & bil>3 // G4 = immigration neutral / bilaterals negative
replace immibil9=. if immi==. | bil==. 
label var immibil9 "Opinion about immigration and bilateral treaties"
label def immibil9 1 "nationalist" 2 "internationalist" 3 "alternative cross-pressured" 4 "cross-pressured" 5 "G1" 6 "G2" 7 "G3" 8 "G4" 0 "G5: true neutrals"
label val immibil9 immibil9
tab immibil9


gen party6=1
replace party6=2 if f1085_90==40 //svp
replace party6=3 if f1085_90==10 //fdp
replace party6=4 if f1085_90==20 //cvp
replace party6=5 if f1085_90==30 //sp
replace party6=6 if f1085_90==50 //gps
replace party6=7 if f1085_90==60 //glp
replace party6=1 if f1085_90>400 //no party
label var party6 "major parties (categorical)"
label def party6 1 "other/no party pref" 2 "SVP" 3 "FDP" 4 "CVP" 5 "SP" 6 "GPS" 7 "GLP"
label val party6 party6

***************************
******* Analyses **********
***************************

***************************************
****** Who Is Cross-Pressured? ********
***************************************

/* 
---------------------------------------------
PART 1: Identifying the cross-pressured
---------------------------------------------
We use the average values of individuals' assessment of immigration and the
bilateral treaties and define those as cross-pressured who believe immigration
is bad (average score >3) and bilaterals are good (average score <3). */

	
**********************************************************************************
* Table 4: Control-Cooperation Trade-Off by Party (in Percent), 2015 and 2019
*
* --> this is only the 2015 part of Table 4!
* --> for 2019 part of Table 4 see Table 1 and Figure 1
**********************************************************************************

* overall
tab immibil5

* according to party
tab party6 immibil5, row

**********************************************************************************
* Table A2: Control-Cooperation Trade-Off: Neutrals Split up in Subgroups by Party 
* (in Percent of all Respondents), 2015 and 2019
* 
* --> this is only the 2015 part of Table A2!
**********************************************************************************

* overall
tab immibil9

* according to party
tab party6 immibil9, row